package com.mdb.open.epay.domain.dto.epay;

import cn.hutool.core.date.DatePattern;
import com.mdb.bc.api.data.DataObjectBase;
import com.mdb.bc.validator.annotaion.validation.DateFormat;
import com.mdb.bc.validator.annotaion.validation.PositiveDigits;
import com.mdb.open.epay.enums.type.CcyTypeEnum;
import com.mdb.open.epay.enums.type.CustTypeEnum;
import com.mdb.open.epay.enums.type.TradeTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;

/**
 * @author liuyi
 * @date 2019/11/14
 **/
@Data
@ApiModel(description="支付dto对象")
public class PayDto extends DataObjectBase {

    private static final long serialVersionUID = 1L;

    /**
     * 客户类型
     */
    @ApiModelProperty(value = "客户類型")
    @NotNull(message = "客户類型不能为空")
    private CustTypeEnum custType;

    /**
     * 訂單號
     */
    @ApiModelProperty(value = "訂單號")
    @NotBlank(message = "訂單號不能为空")
    @Size(max = 32)
    private String orderNo;

    /**
     * 訂單金額
     */
    @ApiModelProperty(value = "訂單金額")
    @NotNull(message = "訂單金額不能为空")
//    @Digits(integer = 10, fraction = 2, message = "訂單金額要輸入阿拉伯數字（包含小數點及小數點後兩位最大16位）")
//    @Num(regexp = "^\\+?[0-9][0-9]*+(.[0-9]{1,2})?$", message = "訂單金額要輸入阿拉伯數字（包含小數點及小數點後兩位最大16位）")
    @PositiveDigits(integer = 10, fraction = 2, message = "訂單金額要輸入阿拉伯數字（包含小數點及小數點後兩位最大12位）")
    private BigDecimal orderAmt;

    /**
     * 訂單時間
     */
    @ApiModelProperty(value = "訂單時間yyyyMMddHHmmss")
    @NotBlank(message = "訂單時間不能为空")
    @Size(min = 14, max = 14, message = "訂單時間不正確")
    @DateFormat(format = DatePattern.PURE_DATETIME_PATTERN, message = "訂單時間不正確")
    private String orderTime;

    /**
     * 幣種
     */
    @ApiModelProperty(value = "幣種")
    @NotNull(message = "幣種不能为空")
    private CcyTypeEnum currency = CcyTypeEnum.MOP;

    /**
     * 銀行簽約協議號
     */
    @ApiModelProperty(value = "銀行簽約協議號")
    @NotBlank(message = "銀行簽約協議號不能为空")
    @Size(max = 32)
    private String bankSignNo;

    /**
     * 交易類型
     */
    @ApiModelProperty(value = "交易類型")
    @NotNull(message = "交易類型不能为空")
    private TradeTypeEnum tradeType;

    /**
     * 短信驗證碼
     */
    @ApiModelProperty(value = "短信驗證碼")
    @Size(min = 6, max = 6)
    private String msgCode;

    /**
     * 交易備註
     */
    @ApiModelProperty(value = "交易備註")
    @Size(max = 256)
    private String remark;
}